package com.emmmya.ocs.common.utils;


import org.springframework.cglib.beans.BeanMap;

import java.util.HashMap;
import java.util.Map;

/**
 * @description:
 * @author: laijieguan
 * @createDate: 2020-05-13
 * @version: 1.0
 */
public class ObjectUtil {
    public static <T> Map<String,Object> beanToMap(T bean){
        HashMap<String, Object> map = new HashMap<>();
        if(bean != null ) {
            BeanMap beanMap = BeanMap.create(bean);
            for (Object key : beanMap.keySet()) {
                map.put(key+"",beanMap.get(key));
            }
        }
        return map;
    }
}
